package com.gumanx;

import java.util.List;



import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentData;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import cpw.mods.fml.common.registry.GameRegistry;

public class util {
	public static void recipes() {
		ItemStack stick = new ItemStack(Item.stick);
		ItemStack diamond = new ItemStack(Item.diamond);
		ItemStack emerald = new ItemStack(Item.emerald);
		ItemStack ingotGold = new ItemStack(Item.ingotGold);
		ItemStack ingotIron = new ItemStack(Item.ingotIron);
		ItemStack coal = new ItemStack(Item.coal);
		ItemStack tnt = new ItemStack(Block.tnt);
		ItemStack string = new ItemStack(Item.silk);
		ItemStack inertEnergy = new ItemStack(_GumanxModBase.ItemInertEnergy);
		ItemStack ingotTungsten = new ItemStack(_GumanxModBase.ItemIngotTungsten);
		ItemStack ingotStellerium = new ItemStack(_GumanxModBase.ItemIngotStellerium);
		ItemStack ingotXerorium = new ItemStack(_GumanxModBase.ItemIngotXerorium);
		ItemStack superXPBottle = new ItemStack(_GumanxModBase.ItemSuperXPBottle);
		ItemStack XPBottle = new ItemStack(Item.expBottle);
		ItemStack bombThrowable = new ItemStack(_GumanxModBase.ItemBombThrowable);
		ItemStack bombThrowableLightning = new ItemStack(_GumanxModBase.ItemBombThrowableLightning);
		ItemStack staffTeleportation = new ItemStack(_GumanxModBase.ItemStaffTeleportaion);
		ItemStack staffScythe = new ItemStack(_GumanxModBase.ItemStaffScythe);
		ItemStack staffExplosion = new ItemStack(_GumanxModBase.ItemStaffExplosion);
		ItemStack staffLightning = new ItemStack(_GumanxModBase.ItemStaffLightning);
		ItemStack swordTungsten = new ItemStack(_GumanxModBase.ItemSwordTungsten);
		ItemStack swordStellerium = new ItemStack(_GumanxModBase.ItemSwordStellerium);
		ItemStack swordXerorium = new ItemStack(_GumanxModBase.ItemSwordXerorium);
		ItemStack bowStellerium = new ItemStack(_GumanxModBase.ItemBowStellerium);
		ItemStack rifleBlaster = new ItemStack(_GumanxModBase.ItemWeaponBlasterRifle);
		
		GameRegistry.addShapelessRecipe(superXPBottle, XPBottle, diamond);
		GameRegistry.addShapelessRecipe(bombThrowable, tnt, string);
		GameRegistry.addShapelessRecipe(bombThrowableLightning, inertEnergy,string);
		GameRegistry.addRecipe(diamond, "xxx", "xxx", "xxx", 'x', inertEnergy);
		GameRegistry.addRecipe(emerald, " x ", "xxx", " x ", 'x', inertEnergy);
		GameRegistry.addRecipe(ingotGold, "x x", "x x", "   ", 'x', inertEnergy);
		GameRegistry.addRecipe(ingotIron, "   ", "xxx", "   ", 'x', inertEnergy);
		GameRegistry.addRecipe(coal, "   ", " x ", "   ", 'x', inertEnergy);
		GameRegistry.addRecipe(ingotTungsten, " x ", "x x", " x ", 'x',inertEnergy);
		GameRegistry.addRecipe(ingotXerorium, "xyx", "yny", "xyx", 'x',ingotStellerium, 'y', ingotTungsten, 'n', diamond);
		GameRegistry.addRecipe(staffScythe, "yyx", " x ", "x  ", 'x',ingotStellerium, 'y', diamond);
		GameRegistry.addRecipe(staffTeleportation, "  y", " x ", "x  ", 'x',ingotXerorium, 'y', inertEnergy);
		GameRegistry.addRecipe(staffExplosion, "  y", " x ", "x  ", 'x',ingotXerorium, 'y', tnt);
		GameRegistry.addRecipe(staffLightning, "  y", " x ", "x  ", 'x',ingotXerorium, 'y', diamond);
		GameRegistry.addRecipe(swordTungsten, " x ", " x ", " y ", 'x',ingotTungsten, 'y', stick);
		GameRegistry.addRecipe(swordStellerium, " x ", " x ", " y ", 'x',ingotStellerium, 'y', stick);
		GameRegistry.addRecipe(swordXerorium, " x ", " x ", " y ", 'x',ingotXerorium, 'y', diamond);
		GameRegistry.addRecipe(bowStellerium, " xy", "x y", " xy", 'x',ingotStellerium, 'y', stick);
		GameRegistry.addRecipe(rifleBlaster, "   ", "yxx", "  x", 'x', ingotIron, 'y', diamond);
	
		GameRegistry.addSmelting(_GumanxModBase.BlockOreTungsten.blockID,ingotTungsten, 15f);
		GameRegistry.addSmelting(_GumanxModBase.BlockOreStellerium.blockID,ingotStellerium, 20f);
	}

	public static Vec3 placeInFrontOfEntity(Entity _entity, float meters) {
		Vec3 ret = Vec3.createVectorHelper(0, 0, 0);
		ret.xCoord = _entity.posX;
		ret.yCoord = _entity.posY;
		ret.zCoord = _entity.posZ;
		float yaw = _entity.rotationYaw - 90;
		ret.xCoord -= ((double) (MathHelper.cos(yaw / 180.0F * (float) Math.PI)))
				* meters;
		ret.zCoord -= ((double) (MathHelper.sin(yaw / 180.0F * (float) Math.PI)))
				* meters;
		return ret;
	}
	public static Vec3 placeInRandomDir(int x, int y, int z, float meters) 
	{
		Vec3 ret = Vec3.createVectorHelper(0, 0, 0);
		ret.xCoord = x;
		ret.yCoord = y+1;
		ret.zCoord = z;
		float yaw =(float)Math.random() * 360;
		ret.xCoord -= ((double) (MathHelper.cos(yaw / 180.0F * (float) Math.PI)))
				* meters;
		ret.zCoord -= ((double) (MathHelper.sin(yaw / 180.0F * (float) Math.PI)))
				* meters;
		return ret;
	}

}
